package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IEngineeringInstallCompleteForSuperView;
import com.cloudsigns.factorymanager2.engineering.model.EngineeringInstallCompleteForSuperModel;
import com.cloudsigns.factorymanager2.engineering.model.IEngineeringInstallCompleteForSuperModel;

/**
 * Created by tony on 2018/6/16.
 */

public class EngineeringInstallCompleteForSuperPresenter {

    private IEngineeringInstallCompleteForSuperView view;
    private IEngineeringInstallCompleteForSuperModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public EngineeringInstallCompleteForSuperPresenter(IEngineeringInstallCompleteForSuperView view) {
        this.view = view;
        this.model = new EngineeringInstallCompleteForSuperModel();
    }

    public void engineeringInstallCompleteForSuper() {


        model.engineeringInstallCompleteForSuper(view.getOrderId(), new EngineeringInstallCompleteForSuperModel.OnEngineeringInstallCompleteForSuperListener() {
            @Override
            public void engineeringInstallCompleteForSuperSuccessed() {
                //需要在UI线程执行
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.engineeringInstallCompleteForSuperSuccessed();
                        view.hideLoading();
                    }
                });
            }

            @Override
            public void engineeringInstallCompleteForSuperFailed(final String desc) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.engineeringInstallCompleteForSuperFailed(desc);
                        view.hideLoading();
                    }
                });
            }


        });
    }
}
